package com.ykt.controller;

import java.util.List;

import com.google.common.annotations.VisibleForTesting;
import com.jfinal.ext.route.ControllerBind;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import com.ykt.model.GoodsUnit;

@ControllerBind(controllerKey="/goodsUnit")
public class GoodsUnitController extends BaseController<GoodsUnit>{
	
	public GoodsUnitController(){
		super(GoodsUnit.class);
	}
	

	@Override
	public void combobox() {

        int id = getParaToInt(0, 0);

        List<Record> list = null;
        String sql = "SELECT id,CONCAT(`name`,IFNULL(summary,'')) `name` FROM goods_unit ";

        if (id == 0) list = Db.find(sql);
        else list = Db.find(sql + " where id <>?", id);

        this.renderJson(list);
    }
}
